﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum RoundType
{
    NullTrans = -1,
    RoundBegin = 0,
    RoundIng = 1,
    RoundFight = 2,
    RoundAttackBefor,
    RoundAttackAfter,
    RoundEnd,
    Max = 99,
}


public class RoundStateController  {

    private Dictionary<RoundType, RoundStateBase> stateDic = new Dictionary<RoundType, RoundStateBase>();

    private RoundStateBase m_currState;
    public RoundStateController()
    { }


    public void AddState(RoundStateBase state)
    {
        if (!stateDic.ContainsKey(state.roundType))
            stateDic.Add(state.roundType, state);

    }

    public void SetState(RoundType roundType)
    {
        if (m_currState != null)
            m_currState.Relese();

        m_currState = stateDic[roundType];
        m_currState.Init();
    }
    public void Init()
    {
        m_currState.Init();
    }
    public void Update()
    {
        m_currState.Update();
    }
    public void Release()
    {
        m_currState.Relese();
    }
}
